package com.zufangbao.earth.handler.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView;

import com.zufangbao.earth.entity.particalsystem.AppParticles;
import com.zufangbao.earth.handler.ViewSpecHandler;
import com.zufangbao.earth.web.controller.receivable.ReceivableControllerSpec.IReceivableHistoryToday;
import com.zufangbao.earth.web.controller.receivable.ReceivableControllerSpec.IReceivableNotReachPaymentDateBills;
import com.zufangbao.earth.web.controller.receivable.ReceivableControllerSpec.IReceivableDeferredPaymentDateBills;
import com.zufangbao.earth.web.controller.receivable.ReceivableControllerSpec.IReceivablePaidOutstanding;
import com.zufangbao.earth.web.controller.receivable.ReceivableControllerSpec.IReceivablePaidToday;
import com.zufangbao.earth.web.controller.receivable.ReceivableControllerSpec.IReceivableSummary;
import com.zufangbao.earth.web.controller.receivable.ReceivableControllerSpec.IReceivableTransactionRecord;
import com.zufangbao.earth.web.controller.receivable.ReceivableControllerSpec.IReceivableUnClearedToday;
import com.zufangbao.gluon.api.earth.ReceivablesBrief;
import com.zufangbao.gluon.api.quark.AuthorisedBillSketch;
import com.zufangbao.gluon.api.quark.TransactionRecordSketch;
import com.zufangbao.gluon.handler.impl.BaseViewSpecHandlerImpl;
import com.zufangbao.gluon.spec.earth.GlobalSpec4Earth;
import com.zufangbao.sun.entity.order.Order;

@Component("earthViewSpecHandler")
public class ViewSpecHandlerImpl extends BaseViewSpecHandlerImpl implements ViewSpecHandler{

	@Override
	public ModelAndView historyPaidViewSpec(List<Order> historyPaidOrderList, List<AppParticles> quarkParticals, Object historyPaidTypes, String contractNo, int historyPaidTypeValue, String particalUniqueId, String queryString) {
		Map<String,Object> paramsMap = new HashMap<String,Object>();
		paramsMap.put(IReceivableHistoryToday.RTN_HISTORY_PAID_BILLS, historyPaidOrderList);
		paramsMap.put(IReceivableHistoryToday.RTN_PAYMENT_PARTICLE, quarkParticals);
		paramsMap.put(IReceivableHistoryToday.PARAM_HISTORY_PAID_TYPE, historyPaidTypes);
		paramsMap.put(IReceivableHistoryToday.RTN_CONTRACT_NO,contractNo);
		paramsMap.put(IReceivableHistoryToday.RTN_HISTORY_PAID_TYPE,historyPaidTypeValue);
		paramsMap.put(IReceivableHistoryToday.RTN_PARTICAL_UNIQUE_ID,particalUniqueId);
		paramsMap.put(GlobalSpec4Earth.RTN_PAGE_QUERY_STRING, queryString);
		return pageSpec(IReceivableHistoryToday.VIEW_NAME,paramsMap);
	}
	@Override
	public ModelAndView todayPaidViewSpec(List<AuthorisedBillSketch> todayPaidBills, List<AppParticles> quarkParticals, String queryString) {
		
		Map<String,Object> paramsMap = new HashMap<String,Object>();
		paramsMap.put(IReceivablePaidToday.RTN_TODAY_PAID_BILLS, todayPaidBills);
		paramsMap.put(IReceivablePaidToday.RTN_PAYMENT_PARTICLE, quarkParticals);
		paramsMap.put(GlobalSpec4Earth.RTN_PAGE_QUERY_STRING, queryString);
		return pageSpec(IReceivablePaidToday.VIEW_NAME,paramsMap);
	}
	@Override
	public ModelAndView todayUnClearedViewSpec(List<AuthorisedBillSketch> todayUnClearedBills, List<AppParticles> quarkParticals, String queryString) {
		
		Map<String,Object> paramsMap = new HashMap<String,Object>();
		paramsMap.put(IReceivableUnClearedToday.RTN_TODAY_UNPAID_OUSTANDING_BILLS, todayUnClearedBills);
		paramsMap.put(IReceivableUnClearedToday.RTN_PAYMENT_PARTICLE, quarkParticals);
		paramsMap.put(GlobalSpec4Earth.RTN_PAGE_QUERY_STRING, queryString);
		return pageSpec(IReceivableUnClearedToday.VIEW_NAME,paramsMap);
	}
	@Override
	public ModelAndView outstandingPaidViewSpec(List<AuthorisedBillSketch> outstandingPaidBills, List<AppParticles> quarkParticals, String queryString) {
		Map<String,Object> paramsMap = new HashMap<String,Object>();
		paramsMap.put(IReceivablePaidOutstanding.RTN_OUTSTANDING_PAID_BILLS, outstandingPaidBills);
		paramsMap.put(IReceivablePaidOutstanding.RTN_PAYMENT_PARTICLE, quarkParticals);
		paramsMap.put(GlobalSpec4Earth.RTN_PAGE_QUERY_STRING, queryString);
		return pageSpec(IReceivablePaidOutstanding.VIEW_NAME,paramsMap);
	}
	@Override
	public ModelAndView transactionRecordViewSpec(List<TransactionRecordSketch> transactionRecordSketchs, List<AppParticles> quarkParticals, String queryString) {
		Map<String,Object> paramsMap = new HashMap<String,Object>();
		paramsMap.put(IReceivableTransactionRecord.RTN_TRANSACTION_RECORDS, transactionRecordSketchs);
		paramsMap.put(IReceivableTransactionRecord.RTN_PAYMENT_PARTICLE, quarkParticals);
		paramsMap.put(GlobalSpec4Earth.RTN_PAGE_QUERY_STRING, queryString);
		return pageSpec(IReceivableTransactionRecord.VIEW_NAME,paramsMap);
	}
	
	@Override
	public ModelAndView overPaymentDateViewSpec(List<AuthorisedBillSketch> overPaymentDateBills, List<AppParticles> quarkParticals, String queryString) {
		Map<String,Object> paramsMap = new HashMap<String,Object>();
		paramsMap.put(IReceivableDeferredPaymentDateBills.RTN_OVER_PAYMENT_DATE_BILLS, overPaymentDateBills);
		paramsMap.put(IReceivableDeferredPaymentDateBills.RTN_PAYMENT_PARTICLE, quarkParticals);
		paramsMap.put(GlobalSpec4Earth.RTN_PAGE_QUERY_STRING, queryString);
		return pageSpec(IReceivableDeferredPaymentDateBills.VIEW_NAME,paramsMap);
	}
	@Override
	public ModelAndView notReachPaymentDateViewSpec(List<AuthorisedBillSketch> notReachPaymentDateBills, List<AppParticles> quarkParticals, String queryString) {
		Map<String,Object> paramsMap = new HashMap<String,Object>();
		paramsMap.put(IReceivableNotReachPaymentDateBills.RTN_NOT_REACH_PAYMENT_DATE_BILLS, notReachPaymentDateBills);
		paramsMap.put(IReceivableNotReachPaymentDateBills.RTN_PAYMENT_PARTICLE, quarkParticals);
		paramsMap.put(GlobalSpec4Earth.RTN_PAGE_QUERY_STRING, queryString);
		return pageSpec(IReceivableNotReachPaymentDateBills.VIEW_NAME,paramsMap);
	}
	@Override
	public ModelAndView receivableBriefViewSpec(ReceivablesBrief receivablesBrief, List<AppParticles> quarkParticals, String queryString) {
		Map<String,Object> paramsMap = new HashMap<String,Object>();
		paramsMap.put(IReceivableSummary.RET_RECEIVABLES_BRIEF, receivablesBrief);
		paramsMap.put(IReceivableSummary.RTN_PAYMENT_PARTICLE, quarkParticals);
		paramsMap.put(GlobalSpec4Earth.RTN_PAGE_QUERY_STRING, queryString);
		
		return pageSpec(IReceivableSummary.VIEW_NAME,paramsMap);
	}

}
